<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="/static/blog/img/icon.ico" mce_href="/static/dist/img/icon.png" type="image/x-icon">

    <title>魏先森的博客|做一个有内涵的知识分享者</title>

    <!-- Bootstrap Core CSS -->
    <link href="/static/admins/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/static/admins/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/static/admins/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/static/admins/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="/static/admins/vendor/bootstrap/css/bootstrapValidator.min.css" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <div class="container">
        <div class="row">
{#        	<div class="col-md-12" style="margin:0 auto; text-align:center;">#}
{#                	<img src="/static/dist/img/logo.png" />#}
{#                </div>#}

            <div class="col-md-4 col-md-offset-4">
            	
                <div class="login-panel panel panel-default" style="margin-top: 5%">
                	
                    <div class="panel-heading">
                        <h3 class="panel-title" style="text-align:center;">个人博客-管理后台</h3>
                    </div>
                    <div class="panel-body">
                        <form id="loginForm" role="form" action="{% url 'login' %}?next={{ next  }}" method="POST">{% csrf_token %}
                            <fieldset>
                                <div class="form-group">
                                    <input class="form-control" placeholder="E-mail" name="email" type="email" autofocus>
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="Password" name="password" type="password" value="">
                                </div>
                                <div class="form-group">
                                    <input class="form-control" style="width: 50%;display: inline-block" placeholder="验证码" name="code" type="text" value="">
                                    <img class="" id="check_code_img" src="{% url 'create_code' %}" style="cursor:pointer;width: 40%;display: inline-block;margin: 0 10px 0 10px;float: right" onclick="refresh_check_code(this)">
                                </div>
                                <h6 style="color: red;" align="center"><b>{{ login_err }}</b></h6>
{#                                <div class="checkbox">#}
{#                                    <label>#}
{#                                        <input name="remember" type="checkbox" value="Remember Me">记住我#}
{#                                    </label>#}
{#                                </div>#}
                                <!-- Change this to a button or input when using this as a form -->
                                <button class="btn btn-lg btn-success btn-block" type="submit">
                                    <span>登 录</span>
						        </button>
                            </fieldset>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- jQuery -->
    <script src="/static/admins/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="/static/admins/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="/static/admins/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="/static/admins/dist/js/sb-admin-2.js"></script>
<script src="/static/admins/vendor/bootstrap/js/bootstrapValidator.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#loginForm').bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            email: {
                message: 'The username is not valid',
                validators: {
                    notEmpty: {
                        message: 'The username is required and cannot be empty'
                    },
                    stringLength: {
                        min: 2,
                        max: 30,
                        message: 'The username must be more than 6 and less than 30 characters long'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9_]+$/,
                        message: 'The username can only consist of alphabetical, number and underscore'
                    }
                }
            },
            password:{
                message: "The password is not valid",
                validators:{
                    notEmpty:{
                        'message': "password不得为空！"
                    },
                    stringLength:{
                        min:6,
                        max:30,
                        message:'用户名长度必须大于6个字符，且小于30个字符.'
                    },
                }
            },

            email: {
                validators: {
                    notEmpty: {
                        message: 'Email不得为空！'
                    },
                    emailAddress: {
                        message: '您输入的Email不合法,请重新输入'
                    }
                }
            },
            code: {
                validators: {
                    notEmpty: {
                        message: '请输入正确的验证码！'
                    },
                    stringLength:{
                        min:4,
                        max:4,
                        message:'正确的验证码为4个字符！'
                    },
                }
            }
        }
    });
});

</script>
<script>
    function refresh_check_code(ths) {
        ths.src += '?';
        //src后面加问好会自动刷新验证码img的src
}
</script>
</body>

</html>
